//
//  ZGSCartoonDetailHeadView.m
//  MapleLeaf
//
//  Created by WangZe on 15/11/28.
//  Copyright © 2015年 AntennaBabyTeam. All rights reserved.
//

#import "ZGSCartoonDetailHeadView.h"
#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height

@implementation ZGSCartoonDetailHeadView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}

- (void)createView {
    self.picView = [[UIImageView alloc] init];
    [self addSubview:self.picView];
    
    
    self.titleLabel = [[UILabel alloc] init];
    [self addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize:19];
   
    
    self.typeLabel = [[UILabel alloc] init];
    self.typeLabel.font = [UIFont systemFontOfSize:13];
    self.typeLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    [self addSubview:self.typeLabel];
   
    
    self.authorLabel = [[UILabel alloc] init];
    self.authorLabel.font = [UIFont systemFontOfSize:13];
    self.authorLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    [self addSubview:self.authorLabel];

    
    self.companyLabel = [[UILabel alloc] init];
    self.companyLabel.font = [UIFont systemFontOfSize:13];
    self.companyLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    [self addSubview:self.companyLabel];

    
    self.totalLabel = [[UILabel alloc] init];
    self.totalLabel.font = [UIFont systemFontOfSize:14];
    self.totalLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    [self addSubview:self.totalLabel];
   
    
    self.papularLabel = [[UILabel alloc] init];
    self.papularLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    self.papularLabel.font = [UIFont systemFontOfSize:14];
    self.papularLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.papularLabel];
    
    
    self.plotLabel = [[UILabel alloc] init];
    [self addSubview:self.plotLabel];
    self.plotLabel.font = [UIFont systemFontOfSize:14];
    self.plotLabel.numberOfLines = 2;
   
    
    self.allPlotLabel = [[UILabel alloc] init];
    [self addSubview:self.allPlotLabel];
    self.allPlotLabel.font = [UIFont systemFontOfSize:14];
    self.allPlotLabel.numberOfLines = 0;
    
    
    self.commentLabel = [[UILabel alloc] init];
    self.commentLabel.text = @"详情";
    [self addSubview:self.commentLabel];
    self.commentLabel.textAlignment = NSTextAlignmentCenter;
   
    
    
    
    
    self.statusLabel = [[UILabel alloc] init];
    self.statusLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    self.statusLabel.font = [UIFont systemFontOfSize:14];
    self.statusLabel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.statusLabel];
 
    
    
    self.shareLabel = [[UILabel alloc] init];
    [self addSubview:self.shareLabel];
    self.shareLabel.textColor = [UIColor colorWithRed:0.404f green:0.408f blue:0.408f alpha:1.00f];
    self.shareLabel.font = [UIFont systemFontOfSize:14];
    self.shareLabel.textAlignment = NSTextAlignmentCenter;
    self.shareLabel.text = @"分享";

    
    self.shareButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.shareButton setBackgroundImage:[UIImage imageNamed:@"iconfont-fenxiang.png"] forState:UIControlStateNormal];
    [self addSubview:self.shareButton];
    
    self.collectionButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.collectionButton.layer.borderWidth = 1.5;
    self.collectionButton.layer.borderColor = [[UIColor colorWithRed:0.886f green:0.882f blue:0.882f alpha:1.00f] CGColor];
    self.collectionButton.layer.cornerRadius = 5;
    self.collectionButton.tintColor = [UIColor blackColor];
    self.collectionButton.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16];
    [self addSubview:self.collectionButton];
    
    self.readButton = [UIButton buttonWithType:UIButtonTypeSystem];
    self.readButton.layer.cornerRadius = 5;
    [self.readButton setTitle:@"开始阅读" forState:UIControlStateNormal];
    self.readButton.tintColor = [UIColor whiteColor];
    self.readButton.backgroundColor = [UIColor colorWithRed:0.961f green:0.325f blue:0.173f alpha:1.00f];
    self.readButton.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:16];
    [self addSubview:self.readButton];
    
    self.showAllPlotButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.showAllPlotButton setTitle:@"展开" forState:UIControlStateNormal];
    [self addSubview:self.showAllPlotButton];
    
    self.notShowAllPlotButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.notShowAllPlotButton setTitle:@"收起" forState:UIControlStateNormal];
    [self addSubview:self.notShowAllPlotButton];
    
    self.readCommentButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [self.readCommentButton setBackgroundImage:[UIImage imageNamed:@"iconfont-tiaozhuan.png"] forState:UIControlStateNormal];
    [self addSubview:self.readCommentButton];
    
    
    self.hotImageView = [[UIImageView alloc] init];
    self.hotImageView.image = [UIImage imageNamed:@"iconfont-xiazai.png"];
    [self addSubview:self.hotImageView];
  
    
    self.isFreeImageView = [[UIImageView alloc] init];
    [self addSubview:self.isFreeImageView];
    
    
    self.firstLineView = [[UIView alloc] init];
    self.firstLineView.layer.borderWidth = 1;
    self.firstLineView.layer.borderColor = [[UIColor colorWithRed:0.949f green:0.945f blue:0.957f alpha:1.00f] CGColor];
    [self addSubview:self.firstLineView];

    
    self.secendLineView = [[UIView alloc] init];
    self.secendLineView.layer.borderWidth = 1;
    self.secendLineView.layer.borderColor = [[UIColor colorWithRed:0.949f green:0.945f blue:0.957f alpha:1.00f] CGColor];
    [self addSubview:self.secendLineView];
   
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.picView.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 5, 15, WIDTH / 3, 165);
    self.titleLabel.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 20 + WIDTH / 3, 20, 170, 30);
    self.typeLabel.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 20 + WIDTH / 3, 65, 170, 15);
    self.authorLabel.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 20 + WIDTH / 3, 90, 170, 15);
    self.companyLabel.frame = CGRectMake((WIDTH / 5 - 10)/ 5 + 20 + WIDTH / 3, 115, 170, 15);
    self.totalLabel.frame = CGRectMake((WIDTH / 5 - 10)/ 5 + 20 + WIDTH / 3, 140, 170, 25);
    self.collectionButton.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 5, 190, (WIDTH - ((WIDTH / 5 - 10) / 5 + 5) * 3) / 2, 45);
    self.readButton.frame = CGRectMake(((WIDTH / 5 - 10) / 5 + 5) * 2 + (WIDTH - ((WIDTH / 5 - 10) / 5 + 5) * 3) / 2, 190, (WIDTH - ((WIDTH / 5 - 10) / 5 + 5) * 3) / 2, 45);
    self.hotImageView.frame = CGRectMake(WIDTH / 9 * 1.5, 260, 32, 32);
    self.shareButton.frame = CGRectMake(WIDTH / 9 * 4, 260, 32, 32);
    self.isFreeImageView.frame = CGRectMake(WIDTH / 9 * 6.5, 260, 32, 32);
    self.papularLabel.frame = CGRectMake(WIDTH / 9 * 1.5 - 25, 300, 82, 20);
    self.shareLabel.frame = CGRectMake(WIDTH / 9 * 4, 300, 32, 20);
    self.statusLabel.frame = CGRectMake(WIDTH / 9 * 6.5 - 30, 300, 92, 20);
    self.firstLineView.frame = CGRectMake(0, 331, WIDTH, 2);
    self.commentLabel.frame = CGRectMake(0, 335, WIDTH, 35);
    self.secendLineView.frame = CGRectMake(0, 374, WIDTH, 2);
    self.plotLabel.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 5, 380, WIDTH - ((WIDTH / 5 - 10) / 5 + 5) * 2, 34);
    self.showAllPlotButton.frame = CGRectMake((WIDTH / 5 - 10) / 5 + 5, 414, WIDTH - ((WIDTH / 5 - 10) / 5 + 5) * 2, 20);
    
}

@end
